home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club (Business) 1997 July / Software of the Month Club - Business (Volume 239) (July 1997).iso / pc / code / g.dxr / 00011_G GrowSporesLab Handlers.ls < prev    next >
Encoding:
Text File  |  1996-02-15  |  20.2 KB  |  503 lines

  1. global gHotRects, gObjects, sQTCharSprite, gHaveNavs, gCDName, gFileSep, cNUllCharmovie, gSoundchannels
  2.  
  3. on totalCastMem first, last
  4.   set totalCastMem to 0
  5.   repeat with i = first to last
  6.     set totalCastMem to totalCastMem + (the size of cast i / 1024)
  7.   end repeat
  8. end
  9.  
  10. on jk3
  11.   Jumptokey(#G20)
  12. end
  13.  
  14. on getRadius
  15.   if getaProp(getaProp(gObjects, #GrowSporesLab), #constrainXOBj) <> #NULL then
  16.     if the mouseDown then
  17.       set counter to 1
  18.       if counter = 1 then
  19.         putRadius()
  20.         set counter to counter + 1
  21.       end if
  22.     end if
  23.   end if
  24. end
  25.  
  26. on putRadius
  27.   if getaProp(getaProp(gObjects, #GrowSporesLab), #constrainXOBj) <> #NULL then
  28.     set xConstrainXOBJ to getaProp(getaProp(gObjects, #GrowSporesLab), #constrainXOBj)
  29.   end if
  30.   put "XContrainResult" && xConstrainXOBJ(mWhere, the mouseH, the mouseV) && point(the mouseH, the mouseV)
  31. end
  32.  
  33. on setupG20
  34.   set xConstrainXOBJ to OffScreen(mnew, string(gCDName & "CODE" & gFileSep & "LabDish.BMP"), 0, 0, 4)
  35.   setaProp(getaProp(gObjects, #GrowSporesLab), #constrainXOBj, xConstrainXOBJ)
  36.   if getaProp(getaProp(gObjects, #GrowSporesLab), #solved) = #true then
  37.     setaProp(getaProp(gWorld, #G20), #BgName, the number of cast "G20B.PCT")
  38.   end if
  39. end
  40.  
  41. on cleanUpG20
  42.   set xConstrainXOBJ to getaProp(getaProp(gObjects, #GrowSporesLab), #constrainXOBj)
  43.   if objectp(xConstrainXOBJ) then
  44.     xConstrainXOBJ(mdispose)
  45.   end if
  46.   setaProp(getaProp(gObjects, #GrowSporesLab), #constrainXOBj, #NULL)
  47. end
  48.  
  49. on releaseSpores OBJref
  50.   if getaProp(getaProp(gObjects, #GrowSporesLab), #solved) = #false then
  51.     set OBj to getaProp(gObjects, OBJref)
  52.     set sporeList to getaProp(OBj, #Children)
  53.     set sporesOnPlateList to getaProp(getaProp(gObjects, #GrowSporesLab), #SporesOnPlate)
  54.     repeat with spore in sporeList
  55.       setSporePlateLoc(spore)
  56.       updateStage()
  57.       add(sporesOnPlateList, spore)
  58.       MakeDynamic(spore, #loc, the loc of sprite getaProp(getaProp(gObjects, spore), #SpriteNum))
  59.     end repeat
  60.     MakeDynamic(#GrowSporesLab, #SporesOnPlate, sporesOnPlateList)
  61.   end if
  62.   if count(getaProp(getaProp(gObjects, #GrowSporesLab), #SporesOnPlate)) = 6 then
  63.     DelObjects([#leaf1Obj, #Leaf2Obj])
  64.     MakeDynamic(#leaf1Obj, #Aquired, #false)
  65.     MakeDynamic(#Leaf2Obj, #Aquired, #false)
  66.   end if
  67. end
  68.  
  69. on setSporePlateLoc OBJref
  70.   set testLoc to #invalid
  71.   set newSporeSpriteNum to getaProp(getaProp(gObjects, OBJref), #SpriteNum)
  72.   set newCastNum to getaProp(getaProp(getaProp(gObjects, OBJref), #cast), getaProp(getaProp(gObjects, OBJref), #DisplayState))
  73.   set xConstrainXOBJ to getaProp(getaProp(gObjects, #GrowSporesLab), #constrainXOBj)
  74.   set sporesOnPlateList to getaProp(getaProp(gObjects, #GrowSporesLab), #SporesOnPlate)
  75.   set dishRect to getaProp(getaProp(gObjects, #GrowSporesLab), #dishRect)
  76.   set the randomSeed to the ticks
  77.   set randomLocH to the left of dishRect + random(the right of dishRect - the left of dishRect)
  78.   set randomLocV to the top of dishRect + random(the bottom of dishRect - the top of dishRect)
  79.   set newSporeRect to rect(randomLocH - the width of cast newCastNum, randomLocV - the height of cast newCastNum, randomLocH + the width of cast newCastNum, randomLocV + the height of cast newCastNum)
  80.   if count(sporesOnPlateList) = 0 then
  81.     if xConstrainXOBJ(mWhere, randomLocH, randomLocV) = 0 then
  82.       set the loc of sprite newSporeSpriteNum to point(randomLocH, randomLocV)
  83.     else
  84.       setSporePlateLoc(OBJref)
  85.     end if
  86.   else
  87.     if count(sporesOnPlateList) > 0 then
  88.       if xConstrainXOBJ(mWhere, randomLocH, randomLocV) = 0 then
  89.         set testLoc to #valid
  90.         repeat with oldSpore in sporesOnPlateList
  91.           set oldSporeSpriteNum to getaProp(getaProp(gObjects, oldSpore), #SpriteNum)
  92.           if intersect(newSporeRect, the rect of sprite oldSporeSpriteNum) <> rect(0, 0, 0, 0) then
  93.             set testLoc to #invalid
  94.             exit repeat
  95.           end if
  96.         end repeat
  97.       end if
  98.       if testLoc = #valid then
  99.         set the loc of sprite newSporeSpriteNum to point(randomLocH, randomLocV)
  100.       else
  101.         setSporePlateLoc(OBJref)
  102.       end if
  103.     end if
  104.   end if
  105. end
  106.  
  107. on GrabDragLabNeedles OBJref
  108.   set OBj to getaProp(gObjects, OBJref)
  109.   set moveNeedleFlag to getaProp(getaProp(gObjects, #GrowSporesLab), #moveNeedleFlag)
  110.   set theChildren to getaProp(OBj, #Children)
  111.   set cousin to getAt(getaProp(OBj, #Cousins), 1)
  112.   if (moveNeedleFlag = #true) or (moveNeedleFlag = #noPickUp) then
  113.     cursor(getaProp(gCursorlist, #Grab))
  114.     set lastLocH to the locH of getaProp(OBj, #loc)
  115.     set lastLocV to the locV of getaProp(OBj, #loc)
  116.     set SpriteNum to getaProp(OBj, #SpriteNum)
  117.     set dishCenter to the loc of sprite 1
  118.     set dishConstrainRadius to 112
  119.     set xConstrainXOBJ to getaProp(getaProp(gObjects, #GrowSporesLab), #constrainXOBj)
  120.     set H to the mouseH
  121.     set V to the mouseV
  122.     set OffsetH to H - the locH of sprite SpriteNum
  123.     set OffsetV to V - the locV of sprite SpriteNum
  124.     set loopCount to 0
  125.     if xConstrainXOBJ(mWhere, H, V) = 0 then
  126.       set myGrab to 0
  127.     else
  128.       set myGrab to 1
  129.     end if
  130.     repeat while the stillDown
  131.       set lastLoc to the loc of sprite SpriteNum
  132.       set H to the mouseH
  133.       set V to the mouseV
  134.       if xConstrainXOBJ(mWhere, H - OffsetH, V - OffsetV) = 0 then
  135.         set the locV of sprite SpriteNum to V - OffsetV
  136.         set the locH of sprite SpriteNum to H - OffsetH
  137.       else
  138.         set mouseLocRadius to power(power(the mouseH - the locH of dishCenter, 2) + power(the mouseV - the locV of dishCenter, 2), 0.5)
  139.         if mouseLocRadius = 0 then
  140.           set mouseLocRadius to 1
  141.         end if
  142.         set circumH to the locH of dishCenter + (dishConstrainRadius * (the mouseH - the locH of dishCenter) / mouseLocRadius)
  143.         set circumV to the locV of dishCenter + (dishConstrainRadius * (the mouseV - the locV of dishCenter) / mouseLocRadius)
  144.         set the loc of sprite SpriteNum to point(circumH, circumV)
  145.       end if
  146.       set newRelativeLoc to lastLoc - the loc of sprite SpriteNum
  147.       repeat with Child in theChildren
  148.         PullChild(Child, newRelativeLoc)
  149.       end repeat
  150.       PullCousin(cousin, point(0, the locV of newRelativeLoc))
  151.       if getaProp(getaProp(gObjects, #GrowSporesLab), #moveNeedleFlag) <> #noPickUp then
  152.         if getaProp(getaProp(gObjects, #GrowSporesLab), #FatherSpore) = #none then
  153.           GrabSpore(OBJref)
  154.         else
  155.           set breeding to BreedOffspring(loopCount)
  156.         end if
  157.         if breeding = #true then
  158.           setaProp(getaProp(gObjects, #GrowSporesLab), #moveNeedleFlag, #false)
  159.           playSound("G20FailB.aif", #keyframeCast, #NOW)
  160.           Startthetimer(120, "DissolveOffspring")
  161.           exit repeat
  162.         else
  163.           if breeding = #Ooze then
  164.             MakeDynamic(#GrowSporesLab, #moveNeedleFlag, #false)
  165.             playOozeQT()
  166.             setaProp(getaProp(gStates, #Conditions), #Microscope, #true)
  167.             MakeDynamic(#GrowSporesLab, #solved, #true)
  168.             MakeDynamic(#GrowSporesLab, #moveNeedleFlag, #noPickUp)
  169.             exit repeat
  170.           end if
  171.         end if
  172.       end if
  173.       CursorandUpdate()
  174.       set loopCount to loopCount + 1
  175.     end repeat
  176.     dropSpore(OBJref)
  177.     cursor(getaProp(gCursorlist, #Hand))
  178.     updateStage()
  179.     SetobjLOCRECTG(OBJref)
  180.     SetobjLOCRECTG(cousin)
  181.     repeat with Child in theChildren
  182.       SetobjLOCRECTG(Child)
  183.     end repeat
  184.     CursorandUpdate()
  185.   end if
  186. end
  187.  
  188. on playOozeQT
  189.   setNeedleOozeLocs()
  190.   Startthetimer(1, "killHotRects")
  191.   AddObjects([#OozeQT])
  192.   Startthetimer(60, "startCleanUpOoze")
  193. end
  194.  
  195. on startCleanUpOoze
  196.   Startthetimer(the stopTime of sprite sQTCharSprite - the movieTime of sprite sQTCharSprite + 15, "cleanUpOoze")
  197. end
  198.  
  199. on KillHotRects
  200.   set tempHotRectList to [:]
  201.   set tempHotRectList to gHotRects
  202.   setaProp(getaProp(gObjects, #GrowSporesLab), #tempHotRectList, tempHotRectList)
  203.   set gHotRects to [:]
  204. end
  205.  
  206. on setNeedleOozeLocs
  207.   set the loc of sprite getaProp(getaProp(gObjects, #LeftNeedle), #SpriteNum) to getaProp(getaProp(gObjects, #LeftNeedle), #OozeLoc)
  208.   MakeDynamic(#LeftNeedle, #loc, getaProp(getaProp(gObjects, #LeftNeedle), #OozeLoc))
  209.   MakeDynamic(#LeftNeedle, #Hotrect, getaProp(getaProp(gObjects, #LeftNeedle), #OozeHOTRECT))
  210.   set hotrectnum to integer(getaProp(getaProp(gObjects, #LeftNeedle), #SpriteNum) & "01")
  211.   setaProp(getaProp(gHotRects, hotrectnum), #rect, getAt(getaProp(getaProp(gObjects, #LeftNeedle), #Hotrect), 1))
  212.   set the loc of sprite getaProp(getaProp(gObjects, #LeftKnob), #SpriteNum) to getaProp(getaProp(gObjects, #LeftKnob), #OozeLoc)
  213.   MakeDynamic(#LeftKnob, #loc, getaProp(getaProp(gObjects, #LeftKnob), #OozeLoc))
  214.   MakeDynamic(#LeftKnob, #Hotrect, getaProp(getaProp(gObjects, #LeftKnob), #OozeHOTRECT))
  215.   set hotrectnum to integer(getaProp(getaProp(gObjects, #LeftKnob), #SpriteNum) & "01")
  216.   setaProp(getaProp(gHotRects, hotrectnum), #rect, getAt(getaProp(getaProp(gObjects, #LeftKnob), #Hotrect), 1))
  217.   set the loc of sprite getaProp(getaProp(gObjects, #RightNeedle), #SpriteNum) to getaProp(getaProp(gObjects, #RightNeedle), #OozeLoc)
  218.   MakeDynamic(#RightNeedle, #loc, getaProp(getaProp(gObjects, #RightNeedle), #OozeLoc))
  219.   MakeDynamic(#RightNeedle, #Hotrect, getaProp(getaProp(gObjects, #RightNeedle), #OozeHOTRECT))
  220.   set hotrectnum to integer(getaProp(getaProp(gObjects, #RightNeedle), #SpriteNum) & "01")
  221.   setaProp(getaProp(gHotRects, hotrectnum), #rect, getAt(getaProp(getaProp(gObjects, #RightNeedle), #Hotrect), 1))
  222.   set the loc of sprite getaProp(getaProp(gObjects, #RightKnob), #SpriteNum) to getaProp(getaProp(gObjects, #RightKnob), #OozeLoc)
  223.   MakeDynamic(#RightKnob, #loc, getaProp(getaProp(gObjects, #RightKnob), #OozeLoc))
  224.   MakeDynamic(#RightKnob, #Hotrect, getaProp(getaProp(gObjects, #RightKnob), #OozeHOTRECT))
  225.   set hotrectnum to integer(getaProp(getaProp(gObjects, #RightKnob), #SpriteNum) & "01")
  226.   setaProp(getaProp(gHotRects, hotrectnum), #rect, getAt(getaProp(getaProp(gObjects, #RightKnob), #Hotrect), 1))
  227.   updateStage()
  228. end
  229.  
  230. on cleanUpOoze
  231.   sendSporesNorth()
  232.   set the castNum of sprite 1 to the number of cast "G20B.PCT"
  233.   updateStage()
  234.   DelObjects([#OozeQT])
  235.   set gHotRects to getaProp(getaProp(gObjects, #GrowSporesLab), #tempHotRectList)
  236.   AddTubetoUnv()
  237.   MakeDynamic(#OozeQT, #DisplayState, #OffScreen)
  238. end
  239.  
  240. on sendSporesNorth
  241.   set SporesOnPlate to getaProp(getaProp(gObjects, #GrowSporesLab), #SporesOnPlate)
  242.   repeat with sporeRef in SporesOnPlate
  243.     set the loc of sprite getaProp(getaProp(gObjects, sporeRef), #SpriteNum) to point(-2000, -2000)
  244.     MakeDynamic(sporeRef, #loc, point(-2000, -2000))
  245.   end repeat
  246.   MakeDynamic(#GrowSporesLab, #SporesOnPlate, [])
  247. end
  248.  
  249. on GrabSpore OBJref
  250.   set OBj to getaProp(gObjects, OBJref)
  251.   set needleSpriteNum to getaProp(OBj, #SpriteNum)
  252.   set SporesOnPlate to getaProp(getaProp(gObjects, #GrowSporesLab), #SporesOnPlate)
  253.   if getaProp(OBj, #Children) <> [] then
  254.     exit
  255.   end if
  256.   repeat with sporeRef in SporesOnPlate
  257.     set sporeSpriteNum to getaProp(getaProp(gObjects, sporeRef), #SpriteNum)
  258.     if inside(the loc of sprite needleSpriteNum, the rect of sprite sporeSpriteNum) then
  259.       add(getaProp(OBj, #Children), sporeRef)
  260.       setaProp(getaProp(gObjects, #GrowSporesLab), #FatherSpore, sporeRef)
  261.       playSound("G20jab.aif", #keyframeCast)
  262.       exit
  263.     end if
  264.   end repeat
  265. end
  266.  
  267. on dropSpore OBJref
  268.   set OBj to getaProp(gObjects, OBJref)
  269.   setaProp(OBj, #Children, [])
  270.   setaProp(getaProp(gObjects, #GrowSporesLab), #FatherSpore, #none)
  271.   setaProp(getaProp(gObjects, #GrowSporesLab), #motherSpore, #none)
  272. end
  273.  
  274. on BreedOffspring inCount
  275.   set fatherSporeRef to getaProp(getaProp(gObjects, #GrowSporesLab), #FatherSpore)
  276.   set fatherSporeSpriteNum to getaProp(getaProp(gObjects, fatherSporeRef), #SpriteNum)
  277.   set SporesOnPlate to getaProp(getaProp(gObjects, #GrowSporesLab), #SporesOnPlate)
  278.   set lastMotherSpore to getaProp(getaProp(gObjects, #GrowSporesLab), #motherSpore)
  279.   repeat with motherSporeRef in SporesOnPlate
  280.     set motherSporeSpriteNum to getaProp(getaProp(gObjects, motherSporeRef), #SpriteNum)
  281.     if (motherSporeRef <> fatherSporeRef) and (intersect(the rect of sprite fatherSporeSpriteNum, the rect of sprite motherSporeSpriteNum) <> rect(0, 0, 0, 0)) then
  282.       if inCount = 1 then
  283.         set lastMotherSpore to motherSporeRef
  284.         setaProp(getaProp(gObjects, #GrowSporesLab), #motherSpore, lastMotherSpore)
  285.       end if
  286.       if motherSporeRef <> lastMotherSpore then
  287.         setaProp(getaProp(gObjects, #GrowSporesLab), #motherSpore, motherSporeRef)
  288.         if ((fatherSporeRef <> #spore5) and (fatherSporeRef <> #spore6)) or ((motherSporeRef <> #spore5) and (motherSporeRef <> #spore6)) then
  289.           set fatherIndex to char 6 of string(fatherSporeRef)
  290.           set motherIndex to char 6 of string(motherSporeRef)
  291.           if fatherIndex < motherIndex then
  292.             set offspringCastName to "G20spr" & string(fatherIndex) & string(motherIndex) & ".pct"
  293.           else
  294.             set offspringCastName to "G20spr" & string(motherIndex) & string(fatherIndex) & ".pct"
  295.           end if
  296.           set offspringCastNum to the number of cast offspringCastName
  297.           set numberOffspring to 10 + random(10)
  298.           birthOffspring(offspringCastNum, numberOffspring, fatherSporeSpriteNum, motherSporeSpriteNum)
  299.           return #true
  300.           next repeat
  301.         end if
  302.         return #Ooze
  303.       end if
  304.     end if
  305.   end repeat
  306.   return #false
  307. end
  308.  
  309. on birthOffspring inCastNum, numberOffspring, fatherSporeSpriteNum, motherSporeSpriteNum
  310.   set firstOffspringSpriteNum to getaProp(getaProp(gObjects, #SporeOffspring1), #SpriteNum)
  311.   set motherLoc to the loc of sprite motherSporeSpriteNum
  312.   set growRect to rect(the locH of motherLoc - 140, the locV of motherLoc - 140, the locH of motherLoc + 140, the locV of motherLoc + 140)
  313.   set offspringWidth to the width of cast inCastNum
  314.   set offspringHeight to the height of cast inCastNum
  315.   repeat with i = firstOffspringSpriteNum to firstOffspringSpriteNum + numberOffspring
  316.     set pointFlag to 0
  317.     set the castNum of sprite i to inCastNum
  318.     repeat while pointFlag = 0
  319.       set newLoc to setOffspringPlateLoc(i, offspringWidth, offspringHeight, growRect, motherLoc)
  320.       if ilk(newLoc, #point) then
  321.         set the loc of sprite i to newLoc
  322.         set pointFlag to 1
  323.         set failSoundChannel to playSound("G20failC.aif", #keyframeCast, #NOW)
  324.         waitForSoundDone(failSoundChannel)
  325.         stopsound("G20failC.aif")
  326.       end if
  327.     end repeat
  328.     updateStage()
  329.     add(getaProp(getProp(gObjects, #GrowSporesLab), #OffspringOnPlate), i)
  330.   end repeat
  331. end
  332.  
  333. on setOffspringPlateLoc SpriteNum, offspringWidth, offspringHeight, growRect, motherLoc
  334.   set xConstrainOffspringXOBJ to getaProp(getaProp(gObjects, #GrowSporesLab), #constrainXOBj)
  335.   set sporeRefsOnPlate to getaProp(getProp(gObjects, #GrowSporesLab), #SporesOnPlate)
  336.   set offspringSpritesOnPlate to getaProp(getProp(gObjects, #GrowSporesLab), #OffspringOnPlate)
  337.   set the randomSeed to the ticks
  338.   set randomswitch to random(11)
  339.   if randomswitch <= 7 then
  340.     set randomOffsetH to random(25)
  341.   else
  342.     if randomswitch < 10 then
  343.       set randomOffsetH to 25 + random(50)
  344.     else
  345.       set randomOffsetH to 50 + random(100)
  346.     end if
  347.   end if
  348.   set randomswitch to random(11)
  349.   if randomswitch <= 7 then
  350.     set randomOffsetV to random(25)
  351.   else
  352.     if randomswitch < 10 then
  353.       set randomOffsetV to 25 + random(50)
  354.     else
  355.       set randomOffsetV to 50 + random(100)
  356.     end if
  357.   end if
  358.   set the randomSeed to the ticks
  359.   if random(2) = 1 then
  360.     set randomLocH to the locH of motherLoc + randomOffsetH
  361.   else
  362.     set randomLocH to the locH of motherLoc - randomOffsetH
  363.   end if
  364.   if random(2) = 1 then
  365.     set randomLocV to the locV of motherLoc + randomOffsetV
  366.   else
  367.     set randomLocV to the locV of motherLoc - randomOffsetV
  368.   end if
  369.   set spriteTestRect to rect(randomLocH - integer(offspringWidth / 8), randomLocV - integer(offspringHeight / 8), randomLocH + integer(offspringWidth / 8), randomLocV + integer(offspringHeight / 8))
  370.   if xConstrainOffspringXOBJ(mWhere, randomLocH, randomLocV) = 0 then
  371.     if testSporeLocs(sporeRefsOnPlate, SpriteNum, spriteTestRect) then
  372.       if testOffspringLocs(offspringSpritesOnPlate, SpriteNum, spriteTestRect) then
  373.         return point(randomLocH, randomLocV)
  374.       end if
  375.     end if
  376.   end if
  377. end
  378.  
  379. on testSporeLocs sporeRefsOnPlate, SpriteNum, thisSpriteTestRect
  380.   set testFlag to 1
  381.   repeat with sporeRef in sporeRefsOnPlate
  382.     set sporeSpriteNum to getaProp(getaProp(gObjects, sporeRef), #SpriteNum)
  383.     if intersect(the rect of sprite sporeSpriteNum, thisSpriteTestRect) <> rect(0, 0, 0, 0) then
  384.       set testFlag to 0
  385.       exit repeat
  386.     end if
  387.   end repeat
  388.   return testFlag
  389. end
  390.  
  391. on testOffspringLocs offspringSpritesOnPlate, thisOffspringSpriteNum, thisSpriteTestRect
  392.   set testFlag to 1
  393.   if count(offspringSpritesOnPlate) > 0 then
  394.     repeat with checkOffSpringSpriteNum in offspringSpritesOnPlate
  395.       if intersect(the rect of sprite checkOffSpringSpriteNum, thisSpriteTestRect) <> rect(0, 0, 0, 0) then
  396.         set testFlag to 0
  397.         exit repeat
  398.       end if
  399.     end repeat
  400.   end if
  401.   return testFlag
  402. end
  403.  
  404. on DissolveOffspring
  405.   set offspringOnPlateList to getaProp(getaProp(gObjects, #GrowSporesLab), #OffspringOnPlate)
  406.   repeat with offspringSpriteNum in offspringOnPlateList
  407.     set the loc of sprite offspringSpriteNum to point(-1000, -1000)
  408.   end repeat
  409.   puppetTransition(51, 8, 8, 1)
  410.   setaProp(getaProp(gObjects, #GrowSporesLab), #OffspringOnPlate, [])
  411.   setaProp(getaProp(gObjects, #GrowSporesLab), #moveNeedleFlag, #true)
  412. end
  413.  
  414. on AddTubetoUnv
  415.   if getaProp(getaProp(gObjects, #TubeObj), #Aquired) = #false then
  416.     MakeDynamic(#TubeObj, #Aquired, #true)
  417.     AddObjects([#TubeObj])
  418.   end if
  419. end
  420.  
  421. on PullCousin OBJref, Distance
  422.   set OBj to getaProp(gObjects, OBJref)
  423.   set the loc of sprite getaProp(OBj, #SpriteNum) to the loc of sprite getaProp(OBj, #SpriteNum) - Distance
  424. end
  425.  
  426. on SetobjLOCRECTG OBJref
  427.   set OBj to getaProp(gObjects, OBJref)
  428.   if voidp(OBJref) then
  429.     exit
  430.   end if
  431.   MakeDynamic(OBJref, #loc, the loc of sprite getaProp(OBj, #SpriteNum))
  432.   if not voidp(getaProp(OBj, #Hotrect)) then
  433.     set hotrectnum to integer(getaProp(OBj, #SpriteNum) & "01")
  434.     set newHotRectList to []
  435.     setAt(newHotRectList, 1, the rect of sprite getaProp(OBj, #SpriteNum))
  436.     MakeDynamic(OBJref, #Hotrect, newHotRectList)
  437.     setaProp(getaProp(gHotRects, hotrectnum), #rect, getAt(getaProp(OBj, #Hotrect), 1))
  438.   end if
  439. end
  440.  
  441. on PullChildUPdateG OBJref
  442.   set OBj to getaProp(gObjects, OBJref)
  443.   MakeDynamic(OBJref, #loc, the loc of sprite getaProp(OBj, #SpriteNum))
  444.   if not voidp(getaProp(OBj, #Hotrect)) then
  445.     set hotrectnum to integer(getaProp(OBj, #SpriteNum) & "01")
  446.     set newHotRectList to []
  447.     setAt(newHotRectList, 1, the rect of sprite getaProp(OBj, #SpriteNum))
  448.     MakeDynamic(OBJref, #Hotrect, newHotRectList)
  449.     setaProp(getaProp(gHotRects, hotrectnum), #rect, getAt(getaProp(OBj, #Hotrect), 1))
  450.   end if
  451.   if not voidp(getaProp(OBj, #Children)) then
  452.     set theChildren to getaProp(OBj, #Children)
  453.     repeat with Child in theChildren
  454.       PullChildUPdateG(Child)
  455.     end repeat
  456.   end if
  457. end
  458.  
  459. on ConstDragG OBJref
  460.   set OBj to getaProp(gObjects, OBJref)
  461.   set DirConst to getaProp(OBj, #DirConst)
  462.   set ConstMax to getaProp(OBj, #ConstMax)
  463.   set ConstMin to getaProp(OBj, #ConstMin)
  464.   if not voidp(getaProp(OBj, #Children)) then
  465.     set theChildren to getaProp(OBj, #Children)
  466.   end if
  467.   cursor(getaProp(gCursorlist, #Grab))
  468.   updateStage()
  469.   set OffsetV to the mouseV - the locV of sprite getaProp(OBj, #SpriteNum)
  470.   repeat while the stillDown
  471.     set V to the mouseV - OffsetV
  472.     if (V < ConstMax) and (V > ConstMin) then
  473.       repeat with Child in theChildren
  474.         set Distance to the locV of sprite getaProp(OBj, #SpriteNum) - V
  475.         PullChild(Child, point(0, Distance))
  476.       end repeat
  477.       set the locV of sprite getaProp(OBj, #SpriteNum) to V
  478.       if not voidp(getaProp(getaProp(OBj, #Action), #WhileDown)) then
  479.         do(string(getaProp(getaProp(OBj, #Action), #WhileDown) & "(#" & OBJref & ")"))
  480.       end if
  481.       CursorandUpdate()
  482.     end if
  483.   end repeat
  484.   cursor(getaProp(gCursorlist, #Hand))
  485.   updateStage()
  486.   SetobjLOCRECTG(OBJref)
  487.   repeat with Child in theChildren
  488.     PullChildUPdateG(Child)
  489.   end repeat
  490.   CursorandUpdate()
  491. end
  492.  
  493. on PullChild OBJref, Distance
  494.   set OBj to getaProp(gObjects, OBJref)
  495.   set the loc of sprite getaProp(OBj, #SpriteNum) to the loc of sprite getaProp(OBj, #SpriteNum) - Distance
  496.   if not voidp(getaProp(OBj, #Children)) then
  497.     set theChildren to getaProp(OBj, #Children)
  498.     repeat with Child in theChildren
  499.       PullChild(Child, Distance)
  500.     end repeat
  501.   end if
  502. end
  503.